//author: create by SunJH
//时间: 2021/11/30 0030
//邮箱: 965989158@qq.com
//描述: 数据持久化工具
import 'package:flutter/material.dart';
import 'package:flutter_app/counter/counter_storage.dart';
import 'package:flutter_app/utils/local_storage.dart';
import 'package:get/get.dart';

class StorageTest extends GetView<CounterStorage> {
  const StorageTest({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    Get.put<CounterStorage>(CounterStorage());
    return Scaffold(
      body: Column(
        children: [
          Obx(()=>Text(controller.inputData.value)),
          Text(controller.storageSData.value),
          Text(controller.storageIData.value.toString()),
          Text(controller.storageBData.value.toString()),
          TextField(onChanged: (val){
            controller.inputData.value =val;
          },decoration: InputDecoration(
            suffixIcon: IconButton(
              onPressed: (){
                LocalStorage.getInstance().set(CounterStorage.SKey, controller.inputData.value);
              }, icon: const Icon(Icons.my_location_outlined),
            )
          ),)
        ],
      ),
    );
  }
}
